package controller

import (
	"context"

	"github.com/tiger1103/gfast/v3/api/v1/app"
	"github.com/tiger1103/gfast/v3/api/v1/wxappapi"
	"github.com/tiger1103/gfast/v3/internal/app/app/service"
)

var NewsCategoryController = new(newsCategoryController)

type newsCategoryController struct{}

func (c *newsCategoryController) Get(ctx context.Context, req *wxappapi.GetNewsCategoryReq) (res *app.AppNewsCategoryGetRes, err error) {
	res = new(app.AppNewsCategoryGetRes)
	res.AppNewsCategoryInfoRes, err = service.AppNewsCategory().GetById(ctx, req.Id)
	return
}

func (c *newsCategoryController) List(ctx context.Context, req *wxappapi.ListNewsCategoryReq) (res *app.AppNewsCategorySearchRes, err error) {
	res = new(app.AppNewsCategorySearchRes)
	res.AppNewsCategorySearchRes, err = service.AppNewsCategory().List(ctx, &req.AppNewsCategorySearchReq)
	return
}
